package netcode.server;

import gamePlay.Player;

import java.net.InetAddress;

public class ConnectedClient {
	private Player player;
	private InetAddress address;
	private int port;
	
	public ConnectedClient(InetAddress address, int port,String name){
		this.player = new Player(name);
		this.address = address;
		this.port = port;
	}

	public String getName() {
		return player.getPlayer_name();
	}

	public InetAddress getAddress() {
		return address;
	}
	
	public int getPort(){
		return port;
	}
	
	public Player getPlayer(){
		return player;
	}
	@Override
	public boolean equals(Object obj){
		if(obj instanceof ConnectedClient){
			ConnectedClient temp = (ConnectedClient)obj;
			if(temp.getAddress().equals(address) && temp.getPort() == port && temp.getName().equals(player.getPlayer_name())){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
}
